package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.InstrumentB235;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class InstrumentB235Converter implements AttributeConverter<InstrumentB235, String> {
    @Override
    public String convertToDatabaseColumn(InstrumentB235 instrumentB235) {
        return JSONUtil.toJsonStr(instrumentB235);
    }

    @Override
    public InstrumentB235 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, InstrumentB235.class);
    }
}
